import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'


//element-ui
import Element from 'element-ui'
import "element-ui/lib/theme-chalk/index.css"

Vue.use(Element)


Vue.config.productionTip = false

import { Loading } from 'element-ui'

Vue.prototype.$openLoading = function() {
  const loading = this.$loading({           // 声明一个loading对象
    lock: true,                             // 是否锁屏
    text: '正在加载...',                     // 加载动画的文字
    spinner: 'el-icon-loading',             // 引入的loading图标
    background: 'rgba(0, 0, 0, 0.3)',       // 背景颜色
    target: '.sub-main',                    // 需要遮罩的区域
    body: true,
    customClass: 'mask'                     // 遮罩层新增类名
  })
  setTimeout(function () {                  // 设定定时器，超时5S后自动关闭遮罩层，避免请求失败时，遮罩层一直存在的问题
    loading.close();                        // 关闭遮罩层
  },5000)
  return loading;
}




//公共组件
//引入
import right_column from '@/components/right_column/right_column'
import main_layout from "@/components/main_layout/main_layout";
import { VueSvgIcon } from '@yzfe/vue-svgicon'
import '@yzfe/svgicon/lib/svgicon.css'
import articleCard from "@/components/articleCard/articleCard";
import x_tag from "@/components/x-tag";
import ArticleContent from "@/components/ArticleContent/ArticleContent";

//注册
Vue.component('right-column',right_column)
Vue.component('main-layout',main_layout)
Vue.component('icon', VueSvgIcon)
Vue.component('article-card', articleCard)
Vue.component('x-tag',x_tag)
Vue.component('article-content',ArticleContent)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
